<template>
  <div class="coursedet">
    <div class="top">
      <van-icon @click="$router.back()" style="color:#198bfa" name="arrow-left" />
      <p>课程详情</p>
      <van-icon name="exchange" />
    </div>
    <div class="info">
      <div class="title">
        <span>{{info.title}}</span>
        <van-icon name="star-o" />
      </div>
      <p style="font-size:23px;color:red;margin:23px 0;">
        <van-icon style="font-size:23px;color:#e9bf17" name="refund-o" />
        {{info.price==0?'免费':((info.price)/100).toFixed(2)}}
      </p>
      <div style="font-size:12px;color:#777777">
        <span>共{{info.total_periods}}课时</span>|
        <span>{{info.sales_num}}人报名</span>
      </div>
      <p
        style="font-size:12px;color:#777777;margin:16px 0;"
      >开课时间{{info.start_play_date}}-{{info.end_play_date}}</p>
    </div>
    <div class="teacher">
      <p style="font-size:23px">教学团队</p>
      <ul>
        <li v-for="(item,index) in teacherList" :key="index">
          <img :src="item.avatar" alt />
          <p>{{item.teacher_name}}</p>
        </li>
      </ul>
    </div>
    <div class="details">
      <p style="font-size:23px">课程介绍</p>
      <div class="info_details" v-html="info.course_details"></div>
    </div>
    <div class="dagang">
      <p style="font-size:23px">课程大纲</p>
      
    </div>
    <footer>
        <div class="boot">立即报名</div>
    </footer>
  </div>
</template>
<script>
import { getCourseInfo } from "../../request/home";
import { useRoute } from "vue-router";
import { reactive, toRefs } from "vue";
export default {
  setup(props) {
    let { query } = useRoute();
    getCourseInfo(query.id).then(res => {
      console.log(res);
      data.info = res.data.data.info;
      data.teacherList = res.data.data.teachers;
    });
    const data = reactive({
      info: {},
      teacherList: []
    });
    return { ...toRefs(data) };
  }
};
</script>
<style lang="scss" scoped>
.coursedet {
  background: #f2f2f2;
  height: calc(100% - 63px);
}
.top {
  display: flex;
  padding: 20px 10px;
  align-items: center;
  font-size: 23px;
  border-bottom: 1px solid #f2f2f2;
  background: #fff;
  p {
    width: 90%;
    text-align: center;
  }
}
.info {
  background: #fff;
  padding: 10px 20px;
  box-sizing: border-box;
  height: 210px;
  margin-bottom: 15px;
  .title {
    display: flex;
    font-size: 23px;
    justify-content: space-between;
  }
}
.teacher {
  background: #fff;
  padding: 10px 20px;
  box-sizing: border-box;
  height: 208px;
  margin-bottom: 15px;
  ul {
    display: flex;
    margin: 20px 0;
    li {
      width: 100px;
      height: 88px;
      margin-right: 14px;
      font-size: 12px;
      text-align: center;
      img {
        width: 57px;
        height: 57px;
        border-radius: 50%;
        margin-bottom: 14px;
      }
    }
  }
}
.details {
  background: #fff;
  padding: 10px 20px;
  box-sizing: border-box;
  font-size: 12px;
  .info_details{
  ::v-deep(p){
        margin-top: 12px;
    }
  }
}
.dagang{
    background: #fff;
    height: 145px;
    margin-top: 15px;
    margin-bottom: 20px;
}
footer{
    height: 63px;
}
.boot {
  width: 100%;
  height: 63px;
  text-align: center;
  line-height: 63px;
  position: fixed;
  bottom: 0;
  left: 0;
  background: #eb6100;
  color: #fff;
}
</style>